home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / STRCPYL.ASM < prev    next >
Assembly Source File  |  1991-10-12  |  1KB  |  70 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. stdlib        segment    para public 'slcode'
  6.         assume    cs:stdgrp
  7. ;
  8. ;
  9. ; strcpyl- Copies string pointed at by cs:rtnadrs to dx:si.
  10. ;
  11. ;
  12. ; inputs:
  13. ;        cs:rtn-    Zero-terminated source string.
  14. ;        dx:si-  Buffer for destination string.
  15. ; outputs:
  16. ;        dx:si-    Still points at destination string.
  17. ;
  18. ;
  19. ; Note: The destination buffer must be large enough to hold the string and
  20. ;    zero terminating byte.
  21. ;
  22.         public    sl_strcpyl
  23. ;
  24. rtnadrs        equ    6[bp]
  25. destptr        equ    2[bp]
  26. ;
  27. sl_strcpyl    proc    far
  28.         push    dx
  29.         push    si
  30.         push    bp
  31.         mov    bp, sp
  32.         push    ds
  33.         push    es
  34.         push    di
  35.         push    cx
  36.         push    ax
  37.         pushf
  38. ;
  39.         cld
  40.         mov    al, 0
  41.         mov    cx, 0ffffh
  42.         les    di, rtnadrs
  43.     repne    scasb
  44.         lds    si, rtnadrs
  45.         mov    rtnadrs, di
  46.         les    di, destptr
  47.         neg    cx
  48.         dec    cx
  49.         shr    cx, 1
  50.         jnc    CpyWrd
  51.         lodsb
  52.         stosb
  53. CpyWrd:    rep    movsw
  54. ;
  55. DidByte:    popf
  56.         pop    ax
  57.         pop    cx
  58.         pop    di
  59.         pop    es
  60.         pop    ds
  61.         pop    bp
  62.         pop    si
  63.         pop    dx
  64.         ret
  65. sl_strcpyl    endp
  66. ;
  67. ;
  68. stdlib        ends
  69.         end
  70.